package com.zbs.framework.swagger.utils;


public class ResultUtil {
    public static ResultData ok(){
        return ResultData.build().code(0).message("").data("");
    }

    public static ResultData ok(Object data){
        if (data instanceof ResultData){
            return ok(data);
        }
        return ResultData.build().code(0).data(data).message("");
    }

    public static ResultData ok(ResultData data){
        return ResultData.build().code(0).data(data == null? data : data.getData()).message("").total(data == null? 0 :data.getTotal());
    }


    public static ResultData error(String msg) {
        return ResultData.build().code(403).message(msg).data("");
    }

    public static ResultData error() {
        return ResultData.build().code(-1).message("error...");
    }
}
